<template>
	<div>
		<div class="i_index_title">
			<span class="index_title">修改信息</span>
			<van-icon class="fanhui" size="30" @click="fanhui" name="arrow-left" />
		</div>
		<div class="title_name">
			<van-field v-model="text" maxlength="7" label="昵称" />
		</div>
		<div class="anniu" @click="namer()">
			<span>提交</span>
		</div>
	</div>
	
	
</template>

<script>
	import { Toast } from 'vant';
	export default{
		data(){
			return {
				text:''
			}
		},
		created() {
			
		},
		methods:{
			fanhui(){
				this.$router.go(-1);
			},
			namer(){
				if(this.text==''){
					Toast('不能为空');
				}else{
					this.$axios.post('http://a.chuxingcai.com/prod-api/webapi/user/edit',{
						"avatar": "",
						"clientKey": "h5",
						"nickName": this.text
					},{
						headers:{
							token:window.sessionStorage.getItem('token')
						}
					}).then((res) => {
						console.log(res)
						Toast('修改成功');
						this.$router.go(-1);
					})
				}
				
			}
		}
	}
</script>

<style>
	.i_index_title{
		width: 100%;
		height: 50px;
		background-color: #F74A4B;
	}
	.fanhui{
		position: absolute;
		top: 50%;
		transform: translate(0,-50%);
		color: white;
	}
	.index_title{
		position: absolute;
		top: 50%;
		left: 50%;
		transform: translate(-50%,-50%);
		color: white;
	}
	.title_name{
		width: 95%;
		margin: 10px auto;
	}
	.anniu{
		width: 120px;
		height: 35px;
		background-color: #F74A4B;
		border-radius: 30px;
		text-align: center;
		line-height: 35px;
		color: white;
		margin: 100px auto;
	}
</style>
